﻿using System;
using System.Linq;
using System.IO;
using System.IO.IsolatedStorage;
using System.Collections.Generic;
using Microsoft.LightSwitch;
using Microsoft.LightSwitch.Framework.Client;
using Microsoft.LightSwitch.Presentation;
using Microsoft.LightSwitch.Presentation.Extensions;
namespace LightSwitchApplication
{
    public partial class EditableAddresses
    {
        partial void ImportFromExcel_Execute()
        {
            ExcelImporter.Importer.ImportFromExcel(Addresses);
        }

        partial void gridAddAndEditNew_CanExecute(ref bool result)
        {
            // Write your code here.

        }

        partial void gridAddAndEditNew_Execute()
        {
            this.Application.ShowCreateNewAddress(0,0,0,0);
        }

        partial void gridEditSelected_CanExecute(ref bool result)
        {
            result = (Addresses.SelectedItem != null);
        }

        partial void gridEditSelected_Execute()
        {
            if (Addresses.SelectedItem != null)
                this.Application.ShowAddressDetail(Addresses.SelectedItem.Id);
        }

    }
}
